package map;

import com.alibaba.fastjson.JSON;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class MapInString {


    /**
     * "{\"ma\":1,\"g\":1}" 转成String就是 {"ma":1,"g":1}
     */
    @Test
    public void method1(){
        Map<String, Integer> map = new HashMap<>();
        map.put("ma", 1);
        map.put("g", 1);
        System.out.println("-----------------------------------");
        String jsonString = JSON.toJSONString(map);
        String model = "{\"ma\":1,\"g\":1}";
        System.out.println("result:"+model);
        System.out.println(jsonString.equals(model));
        System.out.println(model);
    }

}
